/*
 * @Author: chengjiang
 * @Date: 2025-04-22 21:45:59
 * @Description:
 */

import type { VxeGridProps } from '#/adapter';

import { Tag } from 'ant-design-vue';

export const authCustomerScopeOptions = [
  { color: 'green', label: '公司', value: 1 },
  { color: 'orange', label: '个人', value: 0 },
];

export const customerColumns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60 },
  // { title: '序号', type: 'seq', width: 50 },
  // { align: 'left', title: 'Name', type: 'checkbox', width: 100 },
  { field: 'id', title: '编号', width: 50 },
  { field: 'name', title: '名称', editRender: { name: 'input' } },
  { field: 'address', title: '地址', editRender: { name: 'input' } }, // formatter: 'formatTime'
  // { field: 'color', title: '日期' },
  { field: 'mobilePhone', title: '联系电话', editRender: { name: 'input' } },
  { field: 'wechatAccount', title: '微信', editRender: { name: 'input' } },
  { field: 'email', title: '邮箱', editRender: { name: 'input' } },
  // TODO responsibleUserId
  {
    field: 'type',
    title: '客户类型',
    width: 80,
    slots: {
      default: ({ row }) => {
        const found = authCustomerScopeOptions.find(
          (item) => item.value === row.type,
        );
        if (found) {
          return <Tag color={found.color}>{found.label}</Tag>;
        }
        return <Tag>{row.type}</Tag>;
      },
    },
  },
  { editRender: { name: 'input' }, field: 'remark', title: '备注' },
  { field: 'action', title: '操作', slots: { default: 'action' } },
];
